/**
 * 文件名称:  StoneAction.java
 * 所属版权:  Stone Technologies Co., Ltd. Copyright 2010-2021, All rights reserved
 * 简单描述:  <描述>
 * 修改作者:  xdli
 * 修改时间:  2012-6-13
 * 修改内容:  <修改内容>
 */
package com.chinastar.iweb.common.struts;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.chinastar.iweb.common.util.ConsultPage;

/**
 * StoneAction
 *  
 * @author  xdli
 * @version 2012-6-13
 * @see     StoneAction
 * @since   1.0
 */
public class StarAction extends ActionSupport
{
    
    public final static String SUCCESS = "success";
    
    public final static String ERROR = "error";
    
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 3230552313867784380L;
    
    public static final Logger _log = Logger.getLogger(StarAction.class);

    /**
     * 获取Request对象
     * @return HttpServletRequest Request对象
     */
    public HttpServletRequest getRequest()
    {
        HttpServletRequest request = ServletActionContext.getRequest();
        return request;
    }
    
    /**
     * 获取Response对象
     * @return HttpServletResponse对象
     */
    public HttpServletResponse getResponse()
    {
        HttpServletResponse response = ServletActionContext.getResponse();
        return response;
    }
    
    /**
     * 获取Session对象
     * @return HttpSession对象
     */
    public HttpSession getSession()
    {
        HttpSession session = getRequest().getSession(false);
        return session;
    }
    
    /**
     * 获取PrintWriter对象
     * @return PrintWriter对象
     * @throws IOException 输入输出异常
     */
    public PrintWriter getPrintWrite() throws IOException
    {
        getResponse().setContentType(ConsultPage.CONTENTTYPE);
        return getResponse().getWriter();
    }
}